package cn.toleo.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.toleo.common.pojo.EasyUITreeNode;
import cn.toleo.common.pojo.ToleoResult;
import cn.toleo.content.service.ContentCategoryService;

/**
 * 内容分类管理controller
 * @author Administrator
 *
 */
@Controller
public class ContentCategoryController {
	@Autowired
	private ContentCategoryService  contentCategoryService;
	
	@RequestMapping("/content/category/list")
	
	@ResponseBody
	public List<EasyUITreeNode> getContentCategoryList(@RequestParam(value="id",defaultValue="0")Long parentId){
		List<EasyUITreeNode> list = contentCategoryService.getContentCategoryList(parentId);
		return list;
	}
	
	@RequestMapping("/content/category/create")
	@ResponseBody
	public ToleoResult addContentCategory(Long parentId,String name){
		ToleoResult result = contentCategoryService.addContentCategory(parentId, name);
		return result;
	}
}
